package csel.view;

import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import csel.model.Entity;

/*
 * Reasons for Existence: 
 * Team Members Responsible
 * Implementation: Alex, Andrew
 * Testing: Alex, Andrew
 */
public class StatsViewer extends JPanel
{
	
	JLabel lives;
    JLabel strength;
    JLabel agility;
    JLabel intellect;
    JLabel hardiness;
    JLabel experience;
    JLabel movement;
    JLabel level;
    JLabel lifeLeft;
    JLabel mana;
    JLabel offensiveRating;
    JLabel defensiveRating;
    JLabel armorRating;
	
	public StatsViewer(Entity e)
	{
		setLayout(new GridLayout(13,2));
        add(new JLabel("Lives Left:"));
        add(lives = new JLabel(Integer.toString(e.getLives())));
        add(new JLabel("Strength:"));
        add(strength = new JLabel(Integer.toString(e.getStrength())));
        add(new JLabel("Agility:"));
        add(agility = new JLabel(Integer.toString(e.getAgility())));
        add(new JLabel("Intellect:"));
        add(intellect = new JLabel(Integer.toString(e.getIntellect())));
        add(new JLabel("Hardiness:"));
        add(hardiness = new JLabel(Integer.toString(e.getHardiness())));
        add(new JLabel("Experience:"));
        add(experience = new JLabel(Integer.toString(e.getExperience())));
        add(new JLabel("Movement:"));
        add(movement = new JLabel(Integer.toString(e.getSpeed())));
        add(new JLabel("Level:"));
        add(level = new JLabel(Integer.toString(e.getLevel())));
        add(new JLabel("Life:"));
        add(life = new JLabel(Integer.toString(e.getLifeLeft())));
        add(new JLabel("Mana:"));
        add(mana = new JLabel(Integer.toString(e.getMana())));
        add(new JLabel("Offensive Rating: "));
        add(offensiveRating = new JLabel(Integer.toString(e.getOffense())));
        add(new JLabel("Defensive Rating:"));
        add(defensiveRating = new JLabel(Integer.toString(e.getDefense())));
        add(new JLabel("Armor Rating:"));
        add(armorRating = new JLabel(Integer.toString(e.getArmor())));
	}

	public void update(Object o)
	{
		Entity e = ((Entity) o);
		lives.setName(e.getLives());
	    strength.setName(e.getStrength());
	    agility.setName(e.getAgility());
	    intellect.setName(e.getIntellect());
	    hardiness.setName(e.getHardiness());
	    experience.setName(e.getExperience());
	    movement.setName(e.getMovement());
	    level.setName(e.getLevel());
	    life.setName(e.getLifeLeft());
	    mana.setName(e.getMana());
	    offensiveRating.setName(e.getOffense());
	    defensiveRating.setName(e.getDefense());
	    armorRating.setName(e.getArmor());
	}
}
